package com.chinackts.config;

import com.chinackts.exceptionadvice.support.dingding.SendDing;
import com.chinackts.exceptionadvice.support.dingding.SendDingForMD;
import okhttp3.OkHttpClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author Lianhong
 * @since 2021/2/5
 */
@Configuration
public class DingConfiguration {

    @Value("${ding.url}")
    private String dingUrl;

    @Value("${ding.secret}")
    private String secret;

    @Bean
    public SendDing sendDingForMD(@Autowired OkHttpClient okHttpClient) {
        return new SendDingForMD(okHttpClient, dingUrl, secret);
    }
}
